import request from '@/utils/request'

export function queryTableName(params) {

    return request({
      url: 'report/design/datasource/queryTableName',
      method: 'get',
      params
    })

  }

  export function addDataSource(data) {
    return request({
        method: 'post',
        url: 'report/design/datasource',
        data
    })
  }

  export function delDataSource(ids) {
    return request({
      url: 'report/design/datasource',
      method: 'delete',
      data: ids
    })
  }

  export function testDataSource(data) {
    return request({
        method: 'post',
        url: 'report/design/datasource/testDataSource',
        data
    })
  }

  export function initDataSource(data) {
    return request({
      method: 'post',
      url: 'report/design/datasource/findAll',
      data
  })
  }

  export function queryFieldBySql(data) {
    return request({
        method: 'post',
        url: 'report/design/datasource/queryFieldBySql',
        data
    })
  }

  export function loadTableData(data) {
    return request({
        method: 'post',
        url: 'report/design/datasource/loadTableData',
        data
    })
  }

  export default { addDataSource, queryTableName, testDataSource,delDataSource,initDataSource,queryFieldBySql,loadTableData}